#!/usr/bin/env node
const Dog = require ('./05-dog.js');
const tadi = new Dog('taidi',5),
      zangao = new Dog ('zangao',6);
tadi.on('bark',onBark);
zangao.on('bark',onBark);
function onBark() {
  console.log(`name:${this.name},energy:${this.energy}`);
}
setTimeout(()=>{
  console.log('taidi eat food');
  tadi.setEnergy(3);
},10000) 
